<template>
  <div class="not-found">
    <div class="content">
      <van-empty
        class="custom-image"
        image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
        :description="message"
      >
        <template #bottom>
          <van-button round type="primary" @click="goHome">返回首页</van-button>
        </template>
      </van-empty>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const message = ref('页面不存在');

const goHome = () => {
  router.replace('/');
};
</script>

<style lang="scss" scoped>
.not-found {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f7f8fa;
  
  .content {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    
    .custom-image {
      padding: 40px 0;
    }
  }
  
  :deep(.van-empty__image) {
    width: 160px;
    height: 160px;
  }
  
  :deep(.van-empty__description) {
    margin-top: 16px;
    font-size: 16px;
    color: #646566;
  }
  
  :deep(.van-button) {
    margin-top: 24px;
    width: 160px;
  }
}
</style>